package com.cx.tran1.service.impl;

import com.cx.annotation.TxTans;
import com.cx.aspec.TranAspec;
import com.cx.domain.TransVO;
import com.cx.tran1.feign.Tran2FeignService;
import com.cx.tran1.mapper.Trans1Mapper;
import com.cx.tran1.service.Tran1Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class Tran1ServiceImpl implements Tran1Service {
    @Autowired
    private Trans1Mapper trans1Mapper;

    @Autowired
    private Tran2FeignService feignService;

    @Override
    @TxTans(isStart = true)
    public String addTest(String p){
        TransVO vo = new TransVO();
        vo.setStr(p);

        feignService.add(p,TranAspec.TRANSKEY.get());
        trans1Mapper.addRecord(vo);

       // Long.parseLong("p");


        return "okadd";
    }

    @Override
    public String updateTest(String p, Long id){
        TransVO vo = new TransVO();
        vo.setId(id.intValue());
        vo.setStr(p);
        trans1Mapper.updateRecord(vo);
        return "opupdate";
    }
}
